from ...interface.protocol.worker_protocol import WorkerProtocol
from ...modules_llm.Sql_LLM import Sql_LLM
from ...utils.SQLiteExcutor import SQLiteExecutor


class Sql_worker(WorkerProtocol):

    def __init__(self,model:Sql_LLM):
        self.model = model
        # print("sql_worker init")

    def start(self):
        """
        启动任务，开始执行任务
        """
        pass

    def recall_context(self,task,context):
        """
        回忆任务的上下文信息，用于任务的处理
        """
        pass


    def process_task(self,task,context):
        # print("sql_worker process_task")
        res =  self.model.process_input(context)
        if res:
            flag = SQLiteExecutor("test.db").execute_sql(res)
            if flag != None and flag != False:
                self.model.get_model_info('执行成功：' + str(res))
            
            print(flag)
        """
        处理任务，根据上下文信息执行任务逻辑
        """
        pass


    def save_memory(self, task_id, context_info):
        """
        保存任务的记忆或上下文信息
        """
        
        
    def destroy(self):
        """
        销毁员工实例，释放资源
        """
        pass
    